package cn.hyl.design.proxy;

import java.lang.reflect.Method;

/**
 * IntermediaryInvocationHandler
 *
 * @author hyl
 * @date 2025-06-09
 */
public class IntermediaryInvocationHandler implements java.lang.reflect.InvocationHandler{

    private Object target;

    public IntermediaryInvocationHandler(Object target){
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        // 中介
        System.out.println("找房源");
        System.out.println("找户型");
        System.out.println("找价格");

        //我
        Object  ret=  method.invoke(target,args);

        //中介
        System.out.println("签约。。");
        System.out.println("签约成功");
        return ret;
    }
}
